package ch.trackedbean.data.validator;

import ch.trackedbean.data.*;
import ch.trackedbean.validator.*;
import ch.trackedbean.validator.internal.*;

/**
 * Validator for {@link TOA}.<br>
 * This one is used to test {@link IBusinessValidator} inheritation.
 * 
 * @author M. Hautle
 */
public class TOABusinessValidator implements IBusinessValidator<TOA> {
    /** The error message returned by this validator. */
    public static final IErrorDescription ERROR = new ErrorDescription("deepvalidation.error");

    /**
     * {@inheritDoc}
     */
    @Override
    public IErrorDescription validate(TOA bean, IValidationContext context) {
        if (bean.getNumber() != bean.getNumberA())
            context.addErrors(TOA.ATTR_NUMBER_A, ERROR);
        return null;
    }

}
